Emacs should no longer hang at startup on kFreeBSD.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Aug 2013 06:11:50 +0000 (23:11 -0700)
committerRob Browning <rlb@defaultvalue.org>
Thu, 26 Sep 2013 18:42:12 +0000 (13:42 -0500)
Applied upstream patch (in conjunction with 5113963):

  Port close-on-exec pty creation to FreeBSD 9.1-RELEASE.

  * configure.ac (PTY_OPEN): If posix_openpt with O_CLOEXEC fails
  and reports EINVAL, try it again without O_CLOEXEC.  This should
  port PTY_OPEN to FreeBSD 9, which stupidly rejects O_CLOEXEC.
  What were they thinking?

Origin: upstream, commit: 51139645c41cec3858f1828303b67be634b8c39937c8580
Added-by: Rob Browning <rlb@defaultvalue.org>
Provided-By: Paul Eggert <eggert@cs.ucla.edu>
Bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15129

ChangeLog
configure.ac

index 961c913d578818d0ab995085966cfaa9d1344d9d..bdabe50a1bc53795014e410d134b5edf03f29859 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-08-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port close-on-exec pty creation to FreeBSD 9.1-RELEASE (Bug#15129).
+       * configure.ac (PTY_OPEN): If posix_openpt with O_CLOEXEC fails
+       and reports EINVAL, try it again without O_CLOEXEC.  This should
+       port PTY_OPEN to FreeBSD 9, which stupidly rejects O_CLOEXEC.
+       What were they thinking?
+
 2013-03-11  Glenn Morris  <rgm@gnu.org>
 
        * Version 24.3 released.
index 28d9d8476041dd8146a60f146fb61ccc606f262a..0c283ef3779f7bddafc6ed42a4635a63ef02cd77 100644 (file)
@@ -3555,7 +3555,7 @@ case $opsys in
       AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
       dnl if HAVE_POSIX_OPENPT
       if test "x$ac_cv_func_posix_openpt" = xyes; then
-        AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)])
+        AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (0)])
         AC_DEFINE(PTY_NAME_SPRINTF, [])
       dnl if HAVE_GETPT
       elif test "x$ac_cv_func_getpt" = xyes; then